
// const { Sequelize, DataTypes } = require("sequelize");

module.exports = (sequelize, DataTypes) => {
  const user = sequelize.define(
    'user',
    {// 在这里定义模型属性
      id: {
        type: DataTypes.INTEGER,
        primaryKey:true,
        autoIncrement:true,
        allowNull:false
      },
      username: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true
      },
      sex:{
        type:DataTypes.STRING,
        allowNull: false
      },
      password: {
        type: DataTypes.STRING,
        allowNull: false
      },
      avator: {
        type: DataTypes.STRING,
        allowNull: false
      },
      email: {
        type: DataTypes.STRING,
        allowNull: false
      },
      phone: {
        type: DataTypes.STRING,
        allowNull: false
      },
      admin: {
        type: DataTypes.STRING,
      }
    }, 
    {
    tableName: "user",//直接提供表名
    timestamps:true,
   }
  );
  return user
}
